#ifndef __COLORFULLOG_H
#define __COLORFULLOG_H
 
#include <stdio.h>
#define COL_LOG
#ifndef LOG_DBG

//颜色宏定义
#define NONE         "\033[m"
#define RED          "\033[0;32;31m"
#define LIGHT_RED    "\033[1;31m"
#define GREEN        "\033[0;32;32m"
#define LIGHT_GREEN  "\033[1;32m"
#define BLUE         "\033[0;32;34m"
#define LIGHT_BLUE   "\033[1;34m"
#define DARY_GRAY    "\033[1;30m"
#define CYAN         "\033[0;36m"
#define LIGHT_CYAN   "\033[1;36m"
#define PURPLE       "\033[0;35m"
#define LIGHT_PURPLE "\033[1;35m"
#define BROWN        "\033[0;33m"
#define YELLOW       "\033[1;33m"
#define LIGHT_GRAY   "\033[0;37m"
#define WHITE        "\033[1;37m"
 
#define LOG_DBG(...)  do{printf(DARY_GRAY "[DBG] %s#%d: " NONE, __FILE__,__LINE__); printf(__VA_ARGS__);}while(0)
#define LOG_INFO(...) do{printf(    GREEN "[INFO]%s#%d: " NONE, __FILE__,__LINE__); printf(__VA_ARGS__);}while(0)
#define LOG_WARN(...) do{printf(   YELLOW "[WARN]%s#%d: " NONE, __FILE__,__LINE__); printf(__VA_ARGS__);}while(0)
#define LOG_ERR(...)  do{printf(LIGHT_RED "[ERRO]%s#%d: " NONE, __FILE__,__LINE__); printf(__VA_ARGS__);}while(0)

#if 0
#define printf_red(str) do{printf("\033[0m\033[1;31m%s\033[0m", str);}while(0)
#define printf_yellow(str) do{printf("\033[0m\033[1;33m%s\033[0m", str);}while(0)
#define printf_green(str) do{ printf("\033[0m\033[1;32m%s\033[0m", str);}while(0)
#define printf_blue(str) do{printf("\033[0m\033[1;34m%s\033[0m", str);}while(0)
#define printf_purple(str) do{printf("\033[0m\033[1;35m%s\033[0m", str);}while(0)
#define printf_cyan(str) do{printf("\033[0m\033[1;36m%s\033[0m", str);}while(0)

#else
#define printf_red(...)     do{printf(RED __VA_ARGS__); printf(NONE); fflush(stdout);}while(0)
#define printf_yellow(...)  do{printf(YELLOW __VA_ARGS__); printf(NONE); fflush(stdout);}while(0)
#define printf_green(...)     do{printf(GREEN __VA_ARGS__); printf(NONE); fflush(stdout);}while(0)
#define printf_blue(...)    do{printf(BLUE __VA_ARGS__); printf(NONE); fflush(stdout);}while(0)
#define printf_purple(...)  do{printf(PURPLE __VA_ARGS__); printf(NONE); fflush(stdout);}while(0)
#define printf_cyan(...)    do{printf(CYAN __VA_ARGS__); printf(NONE); fflush(stdout);}while(0)
#endif

#endif
 
#endif